﻿@{
    ViewBag.Title = "微信支付";
}
@{
    Layout = null;
}

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>微信支付</title>
    @*   <script language="javascript" src="http://res.mail.qq.com/mmr/static/lib/js/jquery.js"></script>
            <script language="javascript" src="http://res.mail.qq.com/mmr/static/lib/js/lazyloadv3.js"></script>
        <script src="../../assets/js/wspay.js?v=1"></script> *@
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <meta id="viewport" name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1; user-scalable=no;" />
    <script language="javascript">
        var paymentCompleleUrl = '@Html.Raw("http://m.rongji365.com/Purchase/PaymentCompleted?ordernumber=" + Request.QueryString["state"])';
        // 当微信内置浏览器完成内部初始化后会触发WeixinJSBridgeReady事件。
        document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
            //alert('@Html.Raw(@ViewBag.Package)');
            WeixinJSBridge.invoke('getBrandWCPayRequest', {
                "appId": "@ViewBag.AppId", //公众号名称，由商户传入
                "timeStamp": "@ViewBag.TimeStamp", //时间戳
                "nonceStr": "@ViewBag.NonceStr", //随机串
                "package": "@Html.Raw(@ViewBag.Package)",//扩展包
                "signType": "@ViewBag.SignType", //微信签名方式:1.sha1
                "paySign": "@ViewBag.Sign" //微信签名
            }, function (res) {
                if (res.err_msg == "get_brand_wcpay_request:ok") {
                    window.location.href = paymentCompleleUrl;
                }
                if (res.err_msg == "get_brand_wcpay_request:cancel") {
                    window.history.back(-1);
                }
            });
            WeixinJSBridge.log('yo~ ready.');
        }, false);
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div>

        </div>
    </form>
</body>
</html>
